<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .parent {
            /* display: flex;
            justify-content: center; */
            width: 400px;
            height: 400px;
            background: #ccc;
            position: relative;
        }

        .child {
            position: absolute;
            /* left: 50%; */
            top: 50%;
            /* transform: translateX(-50%); */
            transform: translateY(-50%);
            /* margin-top: -50px; */
            width: 200px;
            height: 100px;
            background: red;
            margin:0
        }
    </style>
</head>

<body>
    <div class="parent">
        <!-- <span class="child">child-1</span> -->
        <p class="child">child-2</p>
        <p></p>
    </div>
</body>

</html>